import org.apache.spark.{SparkConf, SparkContext}

object WordsCount {
  def main(args: Array[String]) {
    val conf = new SparkConf().setAppName("mySpark")
    conf.setMaster("local")
    val sc =new SparkContext(conf)
    val input=sc.textFile("README.txt")
    val wordsCount=input.flatMap(line=>line.split(" "))
    val count=wordsCount.map(word=>(word,1)).reduceByKey{case(x,y)=>x+y}.foreach(println)

  }
}
